#!/bin/bash
# version: 1.4
# date: 2022/08/04

get_volume(){
    STATUS=`pactl list sinks | grep 静音 | grep '是' | wc -l`
    NUM=`pactl list sinks | grep front | tail -1 | awk '{print $4}' | cut -d'%' -f1`

    if [ "$STATUS" = "1" ]; then
        printf "婢"
    else
        if [ "$NUM" -eq 0 ]; then
            printf "婢"
        elif [ "$NUM" -le 33 ]; then
            printf " %s" "$NUM"
        elif [ "$NUM" -ge 33 ] && [ "$NUM" -le 66 ]; then
            printf "墳 %s" "$NUM"
        else
            printf " %s" "$NUM"
        fi
    fi
}

get_volume
